﻿using Transformable_Engine_v2.Engine.Network.Interfaces;

namespace Transformable_Engine_v2.Engine.Network.Object
{
    public class NetworkSerializableObject
    {
        public int Id { get; set; }
        public byte[] SerializableObject { get; set; }

        public NetworkSerializableObject()
        {
            
        }

        public NetworkSerializableObject(INetworkSerializable obj)
        {
            SerializableObject = Serialization.Serialize(obj);
            Id = obj.Id;
        }

        public byte[] Serialize()
        {
            return Serialization.Serialize(this);
        }

        public static NetworkSerializableObject Deserialize(byte[] data)
        {
            return Serialization.Deserialize<NetworkSerializableObject>(data);
        }
    }
}